package cn.signalpha.modules.shop.controller.admin;

import cn.signalpha.common.constant.AppConstant;
import cn.signalpha.core.boot.ctrl.BaseController;
import cn.signalpha.core.tool.api.R;
import cn.signalpha.modules.shop.entity.Pattern;
import cn.signalpha.modules.shop.service.PatternService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 控制器
 *
 * @author signalpha
 */
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_SHOP_NAME + "/admin/pattern")
@Api(value = "运营模式", tags = "运营模式")
public class PatternController extends BaseController {

	private final PatternService patternService;

	@GetMapping("/info")
	@ApiOperation(value = "详情", notes = "传入类型")
	public R<Pattern> info(@ApiParam(value = "类型", required = true) @RequestParam String type) {
		return R.data(patternService.getOne(Wrappers.<Pattern>lambdaQuery().eq(Pattern::getType, type)));
	}

}
